//
//  ScreenEnum.swift
//  DKE-Album
//
//  Created by dagny on 2025/9/23.
//  Copyright © 2025 杨东宝. All rights reserved.
//

import Foundation
enum ScreenEnum:Int{

    case ELECTRONICALBUM_0390_BW = 0
    case ELECTRONICALBUM_0750_E5 = 1
    case ELECTRONICALBUM_0970_E5 = 2
    case ELECTRONICALBUM_1160_E5 = 3
    case ELECTRONICALBUM_1330_E6 = 4
    case ELECTRONICALBUM_2530_BW = 5
    case ELECTRONICALBUM_2530_E6 = 6
    case ELECTRONICALBUM_2800_E6 = 7
    case ELECTRONICALBUM_3120_BW = 8
    case ELECTRONICALBUM_3150_E6 = 9
    case ELECTRONICALBUM_4200_BW = 10
    
}
struct Screen {
    let name: String // 屏幕尺寸名字
    let width: Int //屏幕宽度 pix
    let height:Int //屏幕高度 pix
    let pixToit:Int // 一个像素点占用几个Bit
    let screenType:ScreenEnum
    var allBytes:Int{ // 屏幕图片计算以后占用多少个字节
        return width * height * pixToit / 8
    }
  
    init(name: String, width: Int, height: Int, pixToit: Int,screen:ScreenEnum) {
        self.name = name
        self.width = width
        self.height = height
        self.pixToit = pixToit
        self.screenType = screen
    }

}
let screenArray:[Screen] = [ELECTRONICALBUM_0390_BW,
                   ELECTRONICALBUM_0750_E5,
                   ELECTRONICALBUM_0970_E5,
                   ELECTRONICALBUM_1160_E5,
                   ELECTRONICALBUM_1330_E6,
                   ELECTRONICALBUM_2530_BW,
                   ELECTRONICALBUM_2530_E6,
                   ELECTRONICALBUM_2800_E6,
                   ELECTRONICALBUM_3120_BW,
                   ELECTRONICALBUM_3150_E6,
                   ELECTRONICALBUM_4200_BW]

let ELECTRONICALBUM_0390_BW = Screen(name: String(format: "3.90 \(getInce()),672x496(2 \(getColor()))"), width: 672, height: 496, pixToit: 4,screen: .ELECTRONICALBUM_0390_BW)
let ELECTRONICALBUM_0750_E5 = Screen(name: String(format: "7.50 \(getInce()),800x480(4 \(getColor()))"), width: 800, height: 480, pixToit: 4,screen: .ELECTRONICALBUM_0750_E5)

let ELECTRONICALBUM_0970_E5 = Screen(name: String(format: "9.70 \(getInce()),960x672(4 \(getColor()))"), width: 960, height: 672, pixToit: 2,screen: .ELECTRONICALBUM_0970_E5)

let ELECTRONICALBUM_1160_E5 = Screen(name: String(format: "11.60 \(getInce()),960x640(4 \(getColor()))"), width: 960, height: 640, pixToit: 2,screen: .ELECTRONICALBUM_1160_E5)

let ELECTRONICALBUM_1330_E6 = Screen(name: String(format: "13.30 \(getInce()),1200x1600(6 \(getColor()))"), width: 1200, height: 1600, pixToit: 4,screen: .ELECTRONICALBUM_1330_E6)

let ELECTRONICALBUM_2530_BW = Screen(name: String(format: "25.30 \(getInce()),3200x1800(2 \(getColor()))"), width: 3200, height: 1800, pixToit: 4,screen: .ELECTRONICALBUM_2530_BW)

let ELECTRONICALBUM_2530_E6 = Screen(name: String(format: "25.30 \(getInce()),3200x1800(6 \(getColor()))"), width: 3200, height: 1800, pixToit: 4,screen: .ELECTRONICALBUM_2530_E6)

let ELECTRONICALBUM_2800_E6 = Screen(name: String(format: "28.00 \(getInce()),3840x1080(6 \(getColor()))"), width: 3840, height: 1080, pixToit: 4,screen: .ELECTRONICALBUM_2800_E6)

let ELECTRONICALBUM_3120_BW = Screen(name: String(format: "31.20 \(getInce()),1440x2560(2 \(getColor()))"), width: 1440, height: 2560, pixToit: 4,screen: .ELECTRONICALBUM_3120_BW)

let ELECTRONICALBUM_3150_E6 = Screen(name: String(format: "31.50 \(getInce()),2560x1440(6 \(getColor()))"), width: 2560, height: 1440, pixToit: 4,screen: .ELECTRONICALBUM_3150_E6)

let ELECTRONICALBUM_4200_BW = Screen(name: String(format: "42.00 \(getInce()),2160x2880(2 \(getColor()))"), width: 2160, height: 2880, pixToit: 4,screen: .ELECTRONICALBUM_4200_BW)


func getInce() -> String{
    let currentLanguageCode = Locale.current.languageCode;
    if currentLanguageCode  == "zh" {
        return "英寸"
    }else{
        return "inch";
    }
}
func getColor() -> String{
    let currentLanguageCode = Locale.current.languageCode;
    if currentLanguageCode  == "zh" {
        return "色"
    }else{
        return "color";
    }
}
func toNameArray() ->Array<SelectItemModel>{
    
    var modelArray = Array<SelectItemModel>()
    
    for screen in screenArray {
        let model = SelectItemModel(name: screen.name, iconName: "screen")
        modelArray.append(model)
    }
    return modelArray
}
func toCMDArray() ->Array<SelectItemModel>{
    
    var modelArray = Array<SelectItemModel>()
    let model1 = SelectItemModel(name: "loopSetting".localized, iconName: "ic_time_settings")
    let model2 = SelectItemModel(name: "pre_image".localized, iconName: "ic_previous")
    let model3 = SelectItemModel(name: "next_image".localized, iconName: "ic_next")
    let model4 = SelectItemModel(name: "clear_list".localized, iconName: "picture_icon_delete")
    let model5 = SelectItemModel(name: "wifi_setting".localized, iconName: "wifi_shezhi")
    
    modelArray.append(model1)
    modelArray.append(model2)
    modelArray.append(model3)
    modelArray.append(model4)
    modelArray.append(model5)
    
    return modelArray
}
func toTransModeArray() ->Array<SelectItemModel>{
    
    var modelArray = Array<SelectItemModel>()

    let model1 = SelectItemModel(name: "bluetooth".localized, iconName: "bluetooth_white")
    modelArray.append(model1)
    let model = SelectItemModel(name: "wifi".localized, iconName: "redian_white")
    modelArray.append(model)
    return modelArray
}
